<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/vue@next"></script>
</head>
<body>

    <div id="app">
        <kfc v-model="a" @click="fn1"></kfc>
        {{a}}
    </div>
    
    <script>


                const app = Vue.createApp({
                    methods:{
                        fn1(ev){
                            console.log('我是根组件的fn1 ')
                            console.log(ev.target)
                        }
                    },
                    data(){
                        return{
                            a:111111
                        }
                    }
                })

                    app.component('kfc',{
                        props:['modelValue'],
                        template:`<h1>
                                    我是kfc组件 {{modelValue}}
                                   <button @click="fn1">我是kfc里面的按钮</button>
                                  </h1> 
                               <h2>9999</h2>
                        `,
                        methods:{
                            fn1(){
                                this.$emit('update:modelValue',99999)
                            }
                        }
                    })

                app.mount("#app")

    </script>
</body>
</html>